package ming.hello.service.impl;

import ming.hello.dao.UserInfoDao;
import ming.hello.entry.UserInfo;
import ming.hello.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by jamy on 2020-09-03
 */
@Service
public class UserInfoServiceImpl implements UserInfoService {
    @Autowired
    private UserInfoDao userInfoDao;

    @Override
    public List<UserInfo> queryUser(String id) {
        return userInfoDao.queryUser(id);
    }

    @Override
    public List<UserInfo> queryUsers() {
        List<String> list = new ArrayList<>();
        list.add("1");
        list.add("2");
        list.add("3");
        list.add("4");
        return userInfoDao.queryUsers(list);
    }

    @Override
    public List<UserInfo> queryUserByNameAndId(Map<String, Object> map) {
        return userInfoDao.queryUserByNameAndId(map);
    }

    @Override
    public void addUsers(List<UserInfo> list) {
        userInfoDao.addUsers(list);
    }

    @Override
    public void deleteUser(String id) {
        userInfoDao.deleteUser(id);
    }

    @Override
    public void updateAddress(Map<String, Object> map) {
        userInfoDao.updateAddressByName(map);
    }
}
